import Vue from 'vue'
import 'normalize.css'
import '@/styles/index.scss'
import '@/styles/element-variables.scss'
import ElementUI from 'element-ui'
import '@bic-fe/mds-ui/dist/mds-ui.min.css' // 引入组件的样式
import MdsUi from '@bic-fe/mds-ui' // 引入组件
import App from './App.vue'
import router from './router'
import store from './store'

import '@/permission'

Vue.use(ElementUI)
Vue.use(MdsUi) // 使用组件

Vue.config.productionTip = false
Vue.config.devtools = true

// 保证 message 只出现一个
const { Message } = MdsUi
Vue.prototype.$message = {
  success: (options: any) => {
    Message.destroy()
    Message.success(options)
  },
  error: (options: any) => {
    Message.destroy()
    Message.error(options)
  },
  info: (options: any) => {
    Message.destroy()
    Message.info(options)
  },
  warning: (options: any) => {
    Message.destroy()
    Message.warning(options)
  },
  loading: (options: any) => {
    Message.destroy()
    Message.loading(options)
  },
  config: Message.config,
  destroy: Message.destroy,
}

new Vue({
  router,
  store,
  render: (h: any) => h(App),
} as any).$mount('#app')
